<template>
  <div class="app-container">
    <el-divider />
    <div v-if="radio1 === '3'">
      <el-form class="my-form" ref="obj" :model="obj" :rules="rules" label-position="right" label-width="auto">
        <table width="100%" height="2200" border="1" align="center" cellpadding="1" cellspacing="1" class="table-form">
          <tr>
            <td colspan="2">部门名称11111:</td>
            <td colspan="4">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.departmentName" rows="3" type="textarea" class="textarea-1" placeholder="请输入部门名称" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td colspan="2">部门职能概述:</td>
            <td colspan="4">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.departmentFnc" rows="3" type="textarea" class="textarea-1" placeholder="请输入职能概述" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td :rowspan="rowNum1">本年</td>
            <td rowspan="9">本年度部门预算收入</td>
            <td>总额（万元）</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入预算收入总额" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>1. 财政拨款收入</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入财政拨款收入" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>其中：一般公共预算</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入一般公共预算" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>政府性基金预算</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入政府性基金预算" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>国有资本经营预算</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入国有资本经营预算" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>2.财政专户管理资金</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入财政专户管理资金" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>3.事业收入</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入事业收入" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>4.经营收入</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入经营收入" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>5.其他收入</td>
            <td colspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入其他收入" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td rowspan="5">年度目标</td>
            <td>部门整体支出目标</td>
            <td>
              <span>关键指标1</span>
              <div>
                <el-button type="primary" text @click="addTarget">新增指标</el-button>
                <el-button type="danger" v-if="obj.yearTask.length > 3" text  @click="deleteTarget">删除指标</el-button>
              </div>
            </td>
            <td colspan="2">预期实现值</td>
          </tr>
          <tr>
            <td rowspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入部门整体支出目标" />
              </el-form-item>
            </td>
            <td rowspan="3">
              <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-form">
                  <tr
                    v-for="(item1,index1) in 4"
                    :style="{borderBottom: index1 == 3 ? 0 : '.0625rem solid gray'}"
                    :height="300 / 4"
                    :key="index1"
                  >
                  <td>
                    <el-form-item class="form-table-textarea" label="">
                      <el-input v-model="aaa" :rows="10 / 4" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                    </el-form-item>
                  </td>
                </tr>
                </table>
            </td>
            <td rowspan="3" colspan="2">
              <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-form">
                  <tr
                    v-for="(item1,index1) in 4"
                    :style="{borderBottom: index1 == 3 ? 0 : '.0625rem solid gray'}"
                    :height="300 / 4"
                    :key="index1"
                  >
                  <td>
                    <el-form-item class="form-table-textarea" label="">
                      <el-input v-model="aaa" :rows="10 / 4" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                    </el-form-item>
                  </td>
                </tr>
                </table>
            </td>
          </tr>
          <tr>
          </tr>
          <tr>
          </tr>
          <tr>
            <td>其中：部门年度整体预算完成率：_____%</td>
            <td>
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入预算收入总额" />
              </el-form-item>
            </td>
            <td colspan="2">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入预算收入总额" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <span>年度主要支出计划（对应任务、政策）</span>
              <div>
                <el-button type="primary" text @click="addPlan1">新增计划</el-button>
                <el-button type="danger" v-if="obj.yearTask.length > 3" text  @click="deletePlan1">删除计划</el-button>
              </div>
            </td>
            <td>任务（政策）的绩效目标</td>
            <td>
              <span>任务（政策）关键性指标（产出、效益、公众满意度方面）</span>
              <div>
                <el-popover placement="bottom" :width="1000" trigger="click">
                  <template #reference>
                    <el-button type="primary" text>新增（指标，绩效）</el-button>
                  </template>
                  <div class="indexs">
                    <template v-for="(item,index) in obj.yearTask" :key="index">
                      <div class="index-list">
                        <div class="index-list-title">
                          <h3>年度主要支出计划（对应任务、政策）{{ index + 1 }}</h3>
                          <el-button type="primary" text @click="addIndexs(index)">新增</el-button>
                        </div>
                        <div class="content-per">
                          <div class="index-list-content" v-for="(item1,index1) in item.indexs" :key="index1">
                            <div class="content-text">指标{{ index1 + 1 }}</div>
                            <el-button type="danger" text @click="deleteIndexs(index,index1)" :disabled="index1 < 4">删除</el-button>
                          </div>
                        </div>
                      </div>
                    </template>
                  </div>
                </el-popover>
              </div>
            </td>
            <td>绩效标准（指标解释及预期实现值）</td>
            <td>主要实施项目（项目名称）</td>
          </tr>
          <template v-for="(item,index) in obj.yearTask" :key="index">
            <tr>
              <td :rowspan="item.indexsNum">
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入任务（政策）" />
                </el-form-item>
              </td>
              <td :rowspan="item.indexsNum">
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入任务（政策）" />
                </el-form-item>
              </td>
              <td>
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                </el-form-item>
              </td>
              <td>
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入绩效标准" />
                </el-form-item>
                </td>
              <td :rowspan="item.indexsNum">
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入项目" />
                </el-form-item>
              </td>
            </tr>
            <template  v-for="(item1,index1) in item.indexs" :key="index1" >
              <tr v-if="index1 > 0">
                <td>
                  <el-form-item class="form-table-textarea" label="" prop="targetAll">
                    <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                  </el-form-item>
                </td>
                <td>
                  <el-form-item class="form-table-textarea" label="" prop="targetAll">
                    <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入绩效标准" />
                  </el-form-item>
                </td>
              </tr>
            </template>
          </template>

          <!--三年期-->

          <tr>
            <td :rowspan="rowNum2">三年期</td>
          </tr>
          <tr>
            <td rowspan="5">三年期目标</td>
            <td>部门整体支出目标</td>
            <td>
              <span>关键指标1</span>
              <div>
                <el-button type="primary" text @click="addTarget">新增指标</el-button>
                <!-- <el-button type="danger" v-if="obj.yearTask.length > 3" text  @click="deleteTarget">删除指标</el-button> -->
              </div>
            </td>
            <td colspan="2">预期实现值</td>
          </tr>
          <tr>
            <td rowspan="3">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入部门整体支出目标" />
              </el-form-item>
            </td>
            <td rowspan="3">
              <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-form">
                  <tr
                    v-for="(item1,index1) in 4"
                    :style="{borderBottom: index1 == 3 ? 0 : '.0625rem solid gray'}"
                    :height="300 / 4"
                    :key="index1"
                  >
                  <td>
                    <el-form-item class="form-table-textarea" label="">
                      <el-input v-model="aaa" :rows="10 / 4" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                    </el-form-item>
                  </td>
                </tr>
                </table>
            </td>
            <td rowspan="3" colspan="2">
              <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-form">
                  <tr
                    v-for="(item1,index1) in 4"
                    :style="{borderBottom: index1 == 3 ? 0 : '.0625rem solid gray'}"
                    :height="300 / 4"
                    :key="index1"
                  >
                  <td>
                    <el-form-item class="form-table-textarea" label="">
                      <el-input v-model="aaa" :rows="10 / 4" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                    </el-form-item>
                  </td>
                </tr>
                </table>
            </td>
          </tr>
          <tr>
          </tr>
          <tr>
          </tr>
          <tr>
            <td>其中：部门年度整体预算完成率：_____%</td>
            <td>
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入预算收入总额" />
              </el-form-item>
            </td>
            <td colspan="2">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入预算收入总额" />
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <span>三年期主要支出计划（对应任务、政策）</span>
              <div>
                <el-button type="primary" text @click="addPlan2">新增计划</el-button>
                <el-button type="danger" v-if="obj.threeYearTask.length > 3" text  @click="deletePlan2">删除计划</el-button>
              </div>
            </td>
            <td>任务（政策）的绩效目标</td>
            <td>
              <span>任务（政策）关键性指标（产出、效益、公众满意度方面）</span>
              <div>
                <el-popover placement="bottom" :width="1000" trigger="click">
                  <template #reference>
                    <el-button type="primary" text>新增（指标，绩效）</el-button>
                  </template>
                  <div class="indexs">
                    <template v-for="(item,index) in obj.threeYearTask" :key="index">
                      <div class="index-list">
                        <div class="index-list-title">
                          <h3>年度主要支出计划（对应任务、政策）{{ index + 1 }}</h3>
                          <el-button type="primary" text @click="addIndexs2(index)">新增</el-button>
                        </div>
                        <div class="content-per">
                          <div class="index-list-content" v-for="(item1,index1) in item.indexs" :key="index1">
                            <div class="content-text">指标{{ index1 + 1 }}</div>
                            <el-button type="danger" text @click="deleteIndexs2(index,index1)" :disabled="index1 < 4">删除</el-button>
                          </div>
                        </div>
                      </div>
                    </template>
                  </div>
                </el-popover>
              </div>
            </td>
            <td>绩效标准（指标解释及预期实现值）</td>
            <td>主要实施项目（项目名称）</td>
          </tr>
          <template v-for="(item,index) in obj.threeYearTask" :key="index">
            <tr>
              <td :rowspan="item.indexsNum">
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入任务（政策）" />
                </el-form-item>
              </td>
              <td :rowspan="item.indexsNum">
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入任务（政策）" />
                </el-form-item>
              </td>
              <td>
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入具体指标名称8" />
                </el-form-item>
              </td>
              <td>
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入指标解释及预期实现值9" />
                </el-form-item>
              </td>
              <td :rowspan="item.indexsNum">
                <el-form-item class="form-table-textarea" label="" prop="targetAll">
                  <el-input v-model="obj.itemFund" rows="14" type="textarea" class="textarea-1" placeholder="请输入项目名称" />
                </el-form-item>
              </td>
            </tr>
            <template  v-for="(item1,index1) in item.indexs" :key="index1" >
              <tr v-if="index1 > 0">
                <td>
                  <el-form-item class="form-table-textarea" label="" prop="targetAll">
                    <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入具体指标名称" />
                  </el-form-item>
                </td>
                <td>
                  <el-form-item class="form-table-textarea" label="" prop="targetAll">
                    <el-input v-model="obj.itemFund" rows="3" type="textarea" class="textarea-1" placeholder="请输入绩效标准" />
                  </el-form-item>
                </td>
              </tr>
            </template>
          </template>
          <tr>
            <td rowspan="4">其他需要说明的情况</td>
            <td rowspan="4" colspan="5">
              <el-form-item class="form-table-textarea" label="" prop="targetAll">
                <el-input v-model="obj.itemFund" rows="4" type="textarea" class="textarea-1" placeholder="请输入其他需要说明的情况" />
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>

    </div>
    <el-dialog v-model="dialogVisible" :title="dialogTypeTitle" width="70%" top="2vh">
      <el-table
        :data="tableData1"
        border
        style="width: 100%;margin-top: 60px;"
      >
        <!-- <el-table-column type="selection" width="39px" /> -->
        <el-table-column align="center" type="index" label="序号" width="60px" />
        <!--
        <el-table-column v-if="isDebug" align="center" label="ID" prop="id" width="60px" sortable show-overflow-tooltip />
        -->
        <el-table-column align="center" label="项目名称" prop="budgetName" min-width="105px" show-overflow-tooltip>
          <template v-slot="{row}">{{ row.budgetName }}</template>
        </el-table-column>
        <el-table-column align="center" label="项目预算金额" prop="itemFund" min-width="105px" show-overflow-tooltip>
          <template v-slot="{row}">{{ row.itemFund }}</template>
        </el-table-column>
        <!-- <el-table-column align="center" label="创建时间" prop="createTime">
          <template v-slot="{row}">{{ row.itemFund }}</template>
        </el-table-column>
        <el-table-column align="center" label="最后修改时间"  prop="updateTime">
          <template v-slot="{row}">{{ row.updateTime }}</template>
        </el-table-column> -->

      </el-table>
      <div style="text-align:right;margin-top: 30px;">
        <el-button type="info" icon="Close" @click="dialogVisible=false">关闭</el-button>
        <el-button type="primary" icon="Check" v-show="dialogType !== 'view'" @click="doConfirm('obj')">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import baseConfig from '@/mixins/baseConfig'
import {doGet, doPost, doPut, doDelete, doGetDownload} from '@/config/http'
import {alertErrorMsg, customValidator, notifySuccess} from "@/config/common"

const props = { multiple: true }

export default {
  name: 'budgetTwoCollectEdit3_nocache',
  mixins: [baseConfig],
  components: {
  },
  data() {
    return {
      summaryOptions: [
        {
          value: 1,
          label: 'Asia',
          children: [
            {
              value: 2,
              label: 'China'
            },
            {
              value: 6,
              label: 'Japan'
            },
            {
              value: 10,
              label: 'Korea'
            },
          ],
        },
        {
          value: 14,
          label: 'Europe',
          children: [
            {
              value: 15,
              label: 'France'
            },
            {
              value: 19,
              label: 'UK',
              children: [
                { value: 20, label: 'London' },
                { value: 21, label: 'Birmingham' },
                { value: 22, label: 'Manchester' },
              ],
            },
          ],
        },
        {
          value: 23,
          label: 'North America',
          children: [
            {
              value: 24,
              label: 'US'
            },
            {
              value: 28,
              label: 'Canada'
            },
          ],
        }
      ],
      oneProject: '',
      twoProject: '',
      isShowProject: false,
      options:[
        {
          value: 'resource',
          label: 'Resource',
          children: [
            {
              value: 'axure',
              label: 'Axure Components',
            },
            {
              value: 'sketch',
              label: 'Sketch Templates',
            },
            {
              value: 'docs',
              label: 'Design Documentation',
            }
          ]
        },
        {
          value: 'resource',
          label: 'Resource',
          children: [
            {
              value: 'axure',
              label: 'Axure Components',
            },
            {
              value: 'sketch',
              label: 'Sketch Templates',
            },
            {
              value: 'docs',
              label: 'Design Documentation',
            }
          ]
        },
        {
          value: 'resource',
          label: 'Resource',
          children: [
            {
              value: 'axure',
              label: 'Axure Components',
            },
            {
              value: 'sketch',
              label: 'Sketch Templates',
            },
            {
              value: 'docs',
              label: 'Design Documentation',
            }
          ]
        },
      ],
      // kpi2List1: ['数量'],
      // kpi2List2: ['经济效益'],
      // kpi2List3: ['具体指标'],
      // kpi2List4: ['数量'],
      // kpi2List5: ['经济效益'],
      // kpi2List6: ['具体指标'],
      // kpi2Options1: ['数量', '质量', '时效', '成本方面'],
      // kpi2Options2: ['经济效益', '时效', '社会效益', '环境效益', '可持续影响等方面'],
      // kpi2Options3: ['具体指标'],
      oHeight: 220,

      aaa: '',
      radio1: '3',
      svc: 'icims-api',
      routes: [],
      dialogVisible: false,
      dialogType: 'add',
      dialogTypeTitle: '汇总明细',
      checkStrictly: false,
      defaultProps: {
        children: 'children',
        label: 'title'
      },
      tableKey: 0,
      tableData: [
        {
          budgetName: '汇总1',
          itemFund: 2000
        },
        {
          budgetName: '汇总2',
          itemFund: 2000
        },
        {
          budgetName: '汇总3',
          itemFund: 2000
        },
        {
          budgetName: '汇总4',
          itemFund: 2000
        },
      ],
      tableData1: [
        {
          budgetName: '项目1',
          itemFund: 100
        },
        {
          budgetName: '项目2',
          itemFund: 100
        },
        {
          budgetName: '项目3',
          itemFund: 100
        },
        {
          budgetName: '项目4',
          itemFund: 100
        },
      ],
      total: 0,
      listLoading: false,
      rowNum1: 27,
      rowNum2: 19,
      // indexsNum1: 4,
      obj: {
        departmentName: null,
        departmentFnc: null,
        itemFund: null,
        yearTask: [
          {
            indexsNum: 4,
            task: '任务1',
            po: '',
            indexs: ["","","", ""],
            ps: ["","","",""],
          },
          {
            indexsNum: 4,
            task: '任务2',
            po: '',
            indexs: ["","","",""],
            ps: ["","","",""],
          },
          {
            indexsNum: 4,
            task: '任务3',
            indexs: ["","","",""],
            po: '',
            ps: ["","","",""],
          }
        ],
        threeYearTask: [
          {
            indexsNum: 4,
            task: '任务1',
            po: '',
            indexs: ["","","", ""],
            ps: ["","","",""],
          },
          {
            indexsNum: 4,
            task: '任务2',
            po: '',
            indexs: ["","","",""],
            ps: ["","","",""],
          },
          {
            indexsNum: 4,
            task: '任务3',
            indexs: ["","","",""],
            po: '',
            ps: ["","","",""],
          }
        ],
      },
      targetList1: [

      ],
      targetList2: [],
      summaryData: [],
      listQuery: {
        pageNum: 1,
        pageSize: 10,
        sortField: 'id',
        sortType: 'desc',
        system: null,
        systemName: null,
        service: null,
        serviceName: null,
        fileType: null,
        fileName: null,
        md5: null,
        size: null,
        storage: null,
        bucket: null,
        path: null,
        original: null,
        downloads: null,
        url: null,
        createTimeStart: null,
        createTimeEnd: null,
        updateTimeStart: null,
        updateTimeEnd: null,
      },
      selectionList: [],
      dialogFormVisible: false,
      dialogStatus: '',
      twoProjectObj: null,
      twoProjectObjName: '',
      rules: {
        system: [{ required: false, validator: customValidator, min: 0, max: 100, label: '系统', trigger: ['blur', 'change'] }],
        systemName: [{ required: false, validator: customValidator, min: 0, max: 100, label: '系统名称', trigger: ['blur', 'change'] }],
        service: [{ required: false, validator: customValidator, min: 0, max: 100, label: '服务', trigger: ['blur', 'change'] }],
        serviceName: [{ required: false, validator: customValidator, min: 0, max: 100, label: '服务名', trigger: ['blur', 'change'] }],
        fileType: [{ required: false, validator: customValidator, min: 0, max: 20, label: '附件类型', trigger: ['blur', 'change'] }],
        fileName: [{ required: false, validator: customValidator, min: 0, max: 200, label: '附件名称', trigger: ['blur', 'change'] }],
        md5: [{ required: false, validator: customValidator, min: 0, max: 50, label: 'MD5值', trigger: ['blur', 'change'] }],
        size: [{ required: false, validator: customValidator, min: 0, max: 20, label: '附件大小(字节)', trigger: ['blur', 'change'] }],
        storage: [{ required: false, validator: customValidator, min: 0, max: 10, label: '附件存储方式', trigger: ['blur', 'change'] }],
        bucket: [{ required: false, validator: customValidator, min: 0, max: 100, label: '附件存储桶', trigger: ['blur', 'change'] }],
        path: [{ required: false, validator: customValidator, min: 0, max: 200, label: '存储路径', trigger: ['blur', 'change'] }],
        original: [{ required: false, validator: customValidator, min: 0, max: 200, label: '原始文件名', trigger: ['blur', 'change'] }],
        downloads: [{ required: false, validator: customValidator, min: 0, max: 20, label: '附件下载次数', trigger: ['blur', 'change'] }],
        url: [{ required: false, validator: customValidator, min: 0, max: 500, label: '附件URL', trigger: ['blur', 'change'] }],
      },
    }

  },
  computed: {
    routesData() {
      return this.routes
    }
  },
  created() {
    console.log(this.$route.query.tab)
    this.radio1 = this.$route.query.tab
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      doGet(this.svc, '/attachment/page', this.listQuery).then(res => {
        this.listLoading = false
        this.list = res['records']
        this.total = parseInt(res['total'])
      }).catch(e => {
        console.error(e)
        this.listLoading = false
      })
    },
    async doConfirm(formName) {
      let v = await this.$refs[formName].validate().catch((err)=>{return err})
      if (v !== true) {
        alertErrorMsg('表单验证不通过，请检查数据。')
        return
      }
      switch (this.dialogType) {
        case "add":
          doPost(this.svc, '/attachment/add', this.obj).then(() => {
            notifySuccess('操作成功')
            this.getList()
            this.dialogVisible = false
          });
          break
        case "edit":
          doPut(this.svc, '/attachment/modify', this.obj).then(() => {
            notifySuccess('操作成功')
            this.getList()
            this.dialogVisible = false
          });
          break
      }
    },
    handleChange(value) {
      console.log(value)
      this.oneProject = value[0]
      this.twoProject = value[1]
    },
    addPlan1() {
      let data = {
        indexsNum: 4,
        task: '任务1',
        po: '',
        indexs: ["","","", ""],
        ps: ["","","",""],
      }
      this.obj.yearTask.push(data)
      this.rowNum1 += 4
    },
    deletePlan1() {
      this.obj.yearTask.pop()
      this.rowNum1 -= 4
    },

    addPlan2() {
      let data = {
        indexsNum: 4,
        task: '任务1',
        po: '',
        indexs: ["","","", ""],
        ps: ["","","",""],
      }
      this.obj.threeYearTask.push(data)
      this.rowNum2 += 4
    },
    deletePlan2() {
      this.obj.threeYearTask.pop()
      this.rowNum2 -= 4
    },
    addTarget() {

    },
    deleteTarget() {

    },
    addIndexs(index) {
      this.obj.yearTask[index].indexs.push("")
      this.obj.yearTask[index].ps.push("")
      this.rowNum1 += 1
      this.obj.yearTask[index].indexsNum += 1
    },
    deleteIndexs(index,index1) {
      this.obj.yearTask[index].indexs.splice(index1, 1)
      this.obj.yearTask[index].ps.splice(index1, 1)
      this.rowNum1 -= 1
      this.obj.yearTask[index].indexsNum -= 1
    },
    addIndexs2(index) {
      this.obj.threeYearTask[index].indexs.push("")
      this.obj.threeYearTask[index].ps.push("")
      this.rowNum2 += 1
      this.obj.threeYearTask[index].indexsNum += 1
    },
    deleteIndexs2(index,index1) {
      this.obj.threeYearTask[index].indexs.splice(index1, 1)
      this.obj.threeYearTask[index].ps.splice(index1, 1)
      this.rowNum2 -= 1
      this.obj.threeYearTask[index].indexsNum -= 1
    },
    summaryOptionsChange(val) {
      console.log('val---------',val)
    },
    changeProjectTwo(data) {
      console.log('222222222222', data.id)
      this.twoProjectObj = data
      this.twoProjectObjName = data.name
    },
    changeProjectTwo1(data) {
      console.log('多选项目返回值', data)
    }
  }
}
</script>
<style>
.textarea-1 .el-textarea__inner{
  /* pointer-events: none; */
  border: none !important;
  resize: none !important;
  outline: none !important;
  border-radius: 0 !important;
}
.form-table-textarea .el-form-item__content{
  /* width: 100%; */
  padding:0;
  margin-left: 0 !important;
}
</style>
<style scoped>
.table-form {
  border-collapse: collapse;
  text-align:center;
}
.el-popper {
  overflow: hidden;
}
.form-list-content-1 .el-form-item__label {
  width: 11.25rem !important;
}
.table-form .form-table-textarea {
  margin-bottom:  0 !important;
}
.textarea-1 .el-textarea__inner{
  /* pointer-events: none; */
  border: none !important;
  resize: none !important;
  outline: none !important;
  border-radius: 0 !important;
}
.btns {
  margin: 1.875rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.project-show-per {
  display: flex;
  align-items: center;
}
.project-show {
  margin-left: 20px;
}
.project-show-title {
  color: #337ecc;
  padding-left: 10px;
}
.indexs {
  display: flex;
  flex-wrap: wrap;
}
.index-list {
  margin: 0 20px
}
.index-list h3 {
  font-weight: bold;
  /* text-align: center; */
}
.content-per {

}
.index-list-content {
  display: flex;
  align-items: center;
}
.content-text {
  width: 300px;
  /* background: red; */
}
.index-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.query-per {
  display: flex;
  align-items: center;
}
.query-per .el-button {
  margin-left: 20px;
}
</style>
